/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Generalized Memory Management.
 *
 * Copyright (C) 2023- Huawei, Inc.
 * Author: Chunsheng Luo
 *
 */
 
#ifndef _REMOTE_PAGER_DEV_H_
#define _REMOTE_PAGER_DEV_H_


#include <linux/ioctl.h>

/* remote pager ioctl parameters */
#define RPG_MAGIC 0x55

enum _GMEM_IOCTL_CMD {
	_GMEM_GET_HNUMA_ID = 1,
	_GMEM_MADVISE = 2,
	_GMEM_MEMCPY = 3,
	_GMEM_IOC_MAX_NR,
};

struct hmadvise_arg {
	int hnid;
	unsigned long start;
	size_t len_in;
	int behavior;
};

struct gmem_hnid_arg {
	int *hnuma_id;
};

struct hmemcpy_arg {
	int hnid;
	unsigned long src;
	unsigned long dest;
	size_t size;
};

#define GMEM_GET_HNUMA_ID  \
	_IOW(RPG_MAGIC, _GMEM_GET_HNUMA_ID, struct gmem_hnid_arg)
#define GMEM_MADVISE \
	_IOW(RPG_MAGIC, _GMEM_MADVISE, struct hmadvise_arg)
#define GMEM_MEMCPY \
	_IOW(RPG_MAGIC, _GMEM_MEMCPY, struct hmemcpy_arg)

int remote_pager_dev_register(void);
void remote_pager_dev_unregister(void);
#endif
